/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem 1rem;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.header p {
    font-size: 1rem;
    opacity: 0.9;
}

/* 主要内容区域 */
.main-content {
    flex: 1;
    padding: 1rem;
}

/* 输入区域 */
.input-section {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.input-container label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #2d3748;
}

.url-input-group {
    display: flex;
    gap: 0.75rem;
    flex-direction: column;
}

@media (min-width: 768px) {
    .url-input-group {
        flex-direction: row;
    }
}

.url-input-group input {
    flex: 1;
    padding: 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.url-input-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 按钮样式 */
.btn {
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
    min-height: 48px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    transform: translateY(-2px);
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #218838;
    transform: translateY(-2px);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    min-height: 36px;
}

/* 加载状态 */
.loading-section {
    text-align: center;
    padding: 3rem 1rem;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner.large {
    width: 60px;
    height: 60px;
    border-width: 6px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 错误提示 */
.error-section {
    text-align: center;
    padding: 2rem 1rem;
}

.error-content {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.error-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

/* 结果区域 */
.result-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* 路线信息卡片 */
.route-info-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.route-header {
    margin-bottom: 1.5rem;
}

.route-header h2 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    color: #2d3748;
}

.route-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: #6c757d;
}

.route-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* 地点列表 */
.places-list {
    margin-bottom: 1.5rem;
}

.place-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 12px;
    margin-bottom: 0.75rem;
    border-left: 4px solid #667eea;
}

.place-number {
    background: #667eea;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    margin-right: 1rem;
    flex-shrink: 0;
}

.place-info {
    flex: 1;
}

.place-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: #2d3748;
}

.place-address {
    font-size: 0.875rem;
    color: #6c757d;
}

/* 操作按钮 */
.route-actions {
    display: flex;
    gap: 1rem;
    flex-direction: column;
}

@media (min-width: 768px) {
    .route-actions {
        flex-direction: row;
    }
}

/* 地图容器 */
.map-container {
    position: relative;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.map {
    width: 100%;
    height: 400px;
    background: #e9ecef;
    position: relative;
}

.map-overlay {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
}

.map-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* 弹窗样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #2d3748;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6c757d;
    padding: 0.25rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem 1.5rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #2d3748;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* 成功提示 */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: #28a745;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    z-index: 10001;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* 底部 */
.footer {
    text-align: center;
    padding: 2rem 1rem;
    color: #6c757d;
    background: white;
    border-top: 1px solid #e2e8f0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header {
        padding: 1.5rem 1rem;
    }
    
    .header h1 {
        font-size: 1.75rem;
    }
    
    .main-content {
        padding: 0.75rem;
    }
    
    .input-section,
    .route-info-card,
    .map-container {
        border-radius: 12px;
        padding: 1rem;
    }
    
    .btn {
        padding: 0.875rem 1.25rem;
        font-size: 0.875rem;
    }
    
    .map {
        height: 300px;
    }
}

/* 多路线展示样式 */
.routes-section {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.routes-section h3 {
    color: #2d3748;
    margin-bottom: 1rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.routes-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.route-card {
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.route-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.15);
}

.route-header {
    margin-bottom: 1rem;
}

.route-title {
    color: #2d3748;
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.route-description {
    color: #6c757d;
    font-size: 0.875rem;
    line-height: 1.5;
}

.route-places {
    margin-bottom: 1rem;
}

.route-places h5 {
    color: #2d3748;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.route-places-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.route-place-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    background: white;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.place-order {
    background: #667eea;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.place-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.place-details .place-name {
    font-weight: 600;
    color: #2d3748;
}

.place-details .place-category {
    font-size: 0.75rem;
    color: #6c757d;
}

.route-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.no-routes {
    text-align: center;
    color: #6c757d;
    padding: 2rem;
    font-style: italic;
}

.route-source {
    background: #e2e8f0;
    color: #4a5568;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* 城市标识样式 */
.city-label {
    background: #e3f2fd;
    color: #1976d2;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    margin-left: 6px;
    font-weight: 500;
}

.alt-name {
    color: #666;
    font-style: italic;
    font-size: 0.8rem;
    margin-left: 6px;
    opacity: 0.8;
}

.region-label {
    background: #f3e5f5;
    color: #7b1fa2;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    margin-right: 6px;
}

/* 加载状态优化 */
.loading-text {
    font-size: 1.1rem;
    color: #2d3748;
    margin-bottom: 1.5rem;
    text-align: center;
    font-weight: 500;
}

/* 地图选择模态框样式 */
.map-options {
    padding: 1rem 0;
}

.map-option {
    display: flex;
    align-items: center;
    padding: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.map-option:hover:not(.disabled) {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.map-option.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f8f9fa;
}

.map-icon {
    font-size: 2rem;
    margin-right: 1rem;
    width: 60px;
    text-align: center;
}

.map-info {
    flex: 1;
}

.map-info h4 {
    margin: 0 0 0.25rem 0;
    color: #2d3748;
    font-size: 1.1rem;
}

.map-info p {
    margin: 0;
    color: #6c757d;
    font-size: 0.9rem;
}

.map-status {
    font-size: 1.5rem;
    margin-left: 1rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
}

/* 信息提示样式 */
.info-toast {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    padding: 1rem 1.5rem;
    z-index: 10001;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    border-left: 4px solid #667eea;
}

.info-toast.show {
    transform: translateX(0);
}

.info-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.info-icon {
    font-size: 1.5rem;
}

.info-content p {
    margin: 0;
    color: #2d3748;
    font-weight: 500;
}
